#ifndef _COMMAND_H
#define _COMMAND_H

#include <compiler.h>

struct cmd {
	const char *name;
	int (*fun)(int argc, char *argv[]);
	const char *help;
	const char *usage;
};

#define MBOOT_CMD(_name, _fun, _help, _usage)						\
	struct cmd __mboot_cmd_##name									\
		__maybe_unused __aligned(4) __section(.mboot_commands) = {	\
		.name  = #_name,											\
		.fun   = _fun,												\
		.help  = _help,												\
		.usage = _usage }

int cmd_usage(const struct cmd *cmd);
struct cmd *cmd_search(const char *cmd);

#endif /* _COMMAND_H */
